package com.kaifamiao.thread.d0928;

public class Demo03 {

    public static void main(String[] args) {
        new MyThread1().start();
        new MyThread2().start();
    }
}

class MyThread1 extends Thread {

    public static int money = 10000;

    @Override
    public void run(){
        while (money == 10000){}

        System.out.println("钱变了");
    }
}

class MyThread2 extends Thread{


    @Override
    public void run(){
        try {
            sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        MyThread1.money = 1;
        System.out.println("钱修改了");
    }
}
